package all.com.jinyongqunxiax.component;

import android.view.View;
import android.widget.TextView;

import all.com.jinyongqunxiax.R;
import androidx.appcompat.widget.SwitchCompat;

public class JxFormItemSwitch extends JxForm.AbstractItemViewModel {
    String  title;
    boolean value;

    public JxFormItemSwitch(int level, String title, boolean value, JxForm.OnClickListener removeButtonListener) {
        super(R.layout.jxform_switch_item, level, removeButtonListener);
        this.title = title;
        this.value = value;
    }

    @Override
    void bind(View view) {
        TextView textView = view.findViewById(R.id.jx_form_switch_item_title);
        if (textView != null) {
            textView.setText(title);
        }
        SwitchCompat switchView = view.findViewById(R.id.jx_form_switch_item_value);
        if (switchView != null) {
            switchView.setChecked(value);
        }
    }

    @Override
    int removeButtonID() {
        return R.id.form_item_delete;
    }
    @Override
    int intentViewID() {
        return R.id.form_header_guide_line;
    }
}
